#coding=utf-8

import util,json

''' this file is to make a publish '''

def pub():
	pub = {}
	pub['name'] = 'seyren_sql'
	pub['destination']='mongo'
	pub['mongo_seyren_url'] = 'mongodb://stream-test-007:27017,stream-test-006:27017/seyren'
	pub['mongo_seyren_collection'] = 'alert2' 
	return pub

def post():
	tennantid = 'dada02c017047c0cfdfafc72'
	url = 'http://9.181.61.102:8080/cpsrestful1/Publishers?tenantid='+ tennantid + '&source=rest'
	publ = pub()
	data = json.dumps(publ)
	header = {}
        header['Content-Type']='application/json;charset=UTF-8'
	util.post(url,data,header)

if __name__ == '__main__':
	post()
